import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'dart:ui';

class MyAppBar extends StatelessWidget {
  Widget leftICon;
  String title;
  Widget rightICon;
  Color textColor;
  MyAppBar({Key key,this.leftICon,@required this.title, this.rightICon,this.textColor}):super(key:key);
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.fromLTRB(0, MediaQueryData.fromWindow(window).padding.top, 0, 0),
      width: ScreenUtil().setWidth(750),
      height:ScreenUtil().setHeight(134),
      decoration: BoxDecoration(
        color: Color.fromRGBO(0, 134, 241, 1.0),
        image: DecorationImage(
          image: AssetImage(
            'static/appbarBg.png'
          ),
          fit: BoxFit.cover
        )
      ),
      child: Row(
        children: <Widget>[
          Container(
            width: ScreenUtil().setHeight(134) - MediaQueryData.fromWindow(window).padding.top,
            height: ScreenUtil().setHeight(134) - MediaQueryData.fromWindow(window).padding.top,
            child: this.leftICon,
          ),
          Expanded(
            child: Center(
              child: Text(
                this.title,
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: TextStyle(
                  fontSize: ScreenUtil().setHeight(38),
                  color: this.textColor
                ),
              ),
            ),
          ),
          Container(
            width: ScreenUtil().setHeight(134) - MediaQueryData.fromWindow(window).padding.top,
            height: ScreenUtil().setHeight(134) - MediaQueryData.fromWindow(window).padding.top,
            child: this.rightICon,
          )
        ],
      ),
    );
  }
}